<template>
	<view class="pages">
	<!-- 使用自定义导航栏组件 -->
	<navBar :title="navTitle" bgColor="#035cf4" @getHeadHeight="getHeadHeight" :backIcon="true" path='/pages/article/article' />
	</navBar>
	<view class="p-2">
		<view class="h3 text-center my-3">{{data.title}}</view>
		<view class="info flex justify-between my-3 text-light-muted">
			<view class="source">{{data.source}}</view>
			<view class="create_time">{{data.created_time}}</view>
		</view>
		<view class="content">
			<u-parse :html="data.content"></u-parse>
		</view>
	</view>
	<BottomBar :selected='selected'></BottomBar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				navTitle:'',
				id: 0,
				data:{},
				HeadNavHeight: 0,
				selected: 2
			}
		},
		onLoad(e) {
			if (!e) {
				return
			}
			console.log(e);
			this.id = e.id
			// 获取当前订单详细资料
			this.getData(this.id)
		},
		methods: {
			getData(){
				this.$H.get('/article/detail/' + this.id, {}, {}).then(res => {
					this.data = res.data;
					this.navTitle = res.category.title
					console.log(this.data)
				});
			},
			// 导航栏高度(单位px)
			getHeadHeight(e) {
				this.HeadNavHeight = e
				console.log(this.HeadNavHeight);
			},
		}
	}
</script>

<style>
.content{
	line-height: 48rpx;
	margin-top: 60rpx;
}
</style>
